<?php
	include('../../../../common/php/authority.php');
	
	$sql = "SELECT id, name FROM userType ORDER BY name";
	$res = mysql_query($sql)or die(mysql_error());
	$num_rows = mysql_num_rows($res);
	
	$typeArr['id'] = 0;
	$typeArr['name'] = 'Без типа';
	$typeArrAll[] = $typeArr;
		
	for ($i = 0; $i < $num_rows; $i++)
	{
		$row = mysql_fetch_array($res);
		$typeArr['id'] = $row['id'];
		$typeArr['name'] = $row['name'];
		$typeArrAll[] = $typeArr;
	}
	
	$arrJson['count'] = $num_rows;
	$arrJson['success']='true';
	$arrJson['types']=$typeArrAll;
	echo json_encode($arrJson);
?>
